home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / pipeline / abacus / p_line / DataBase1 / ReadMe < prev   
Text File  |  1991-12-30  |  13KB  |  238 lines

  1. %OP%VS4.11 (04-Dec-91), Gerald Lewis Fitton, R4000 5065 0380 9644 
  2. %OP%DP0
  3. %OP%IRY
  4. %OP%PL0
  5. %OP%HM0
  6. %OP%FM0
  7. %OP%BM0
  8. %OP%LM4
  9. %OP%FX
  10. %OP%FY
  11. %OP%FS
  12. %OP%PT1
  13. %OP%PDPipeLine
  14. %OP%WC834,2070,172,1620,0,0,0,0
  15. %CO:A,72,72%
  16. %C%A Simple DataBase - Part 1
  17. %C%by Gerald L Fitton
  18. Keywords:
  19. Beginners Database Fitton
  20.  
  21. Introduction
  22. The limitations of Pipedream as a Desk Top Publisher, such as the exact 
  23. positioning of a graphic, really arise because, the screen area is 
  24. divided up into cells so that it can be used as a Spreadsheet.  However 
  25. it is these same cells that make it possible to use PipeDream as a 
  26. simple database.  It is the use of these cells as the fields of a 
  27. database that I shall describe in this article.
  28.  
  29. In a series of articles on the PipeLine 3 discs (starting with the 
  30. October 1990 disc) Stephen Gaynor explains exactly what is meant by a 
  31. relational database and describes the limitations of and 'workarounds' 
  32. for PipeDream 3 when using it as a complex database.  Generally, to 
  33. understand in depth Stephen's approach you need to get familiar with 
  34. database concepts using something simpler.
  35.  
  36. On this disc, in the directories DataBase1 and DataBase2 are examples 
  37. of PipeDream used as a simple database.  The article in DataBase3 
  38. introduces the use of dependent documents in a 'MultiFile' database.
  39.  
  40. Files, Records and Fields
  41. 'MultiFile' databases consist of many files but the simplest of 
  42. databases consist of only one file such as the example [Girls01] in 
  43. this directory.  Load this file.  It shows a typical database formula 
  44. in the formula line (at the top of the document just to the right of 
  45. the 4 f × and €).  You can print out the database file [Girls01], 
  46. preferably using PipeDream printer drivers, and then I suggest that you 
  47. try recreating the database file from the printout using the 
  48. instructions below.
  49.  
  50. The file has eight 'Records' (numbered 1 to 8 for convenience) but 
  51. could have many more.  Each record uses one row in PipeDream and has 
  52. values for every one of five 'Fields'.  The five fields are: 'Name', 
  53. 'Hair Colour', 'Eye Colour', 'Character' and 'Favourite Present' for 
  54. each of the eight (fictitious) young ladies. 
  55.  
  56. At this point I should say that I had considered using a file of 
  57. "E-Y-B" ("Eligible Young Bachelors") instead of an "E-Y-L" ("Eligible 
  58. Young Ladies") file but I then I decided I would live dangerously and 
  59. tempt those of you who think this is sexist to write to me, with a 
  60. counter-example for the quarterly discs, showing me how database 
  61. principles can be applied equally to males!  Besides which, if I were 
  62. to use an "E-Y-B" file I am not sure what particular characteristics 
  63. E-Y-Ls might wish to store on a database about E-Y-Bs!
  64.  
  65. Screen Layout
  66. To make my database fit neatly onto the screen with a small border, I 
  67. have reduced the width of column A to 8 characters (using <Ctrl W>) but 
  68. really, for this example, it isn't necessary; you can use the default 
  69. of 12 characters for all columns.
  70.  
  71. I have used the mouse to set File - Options - Grid so that the grid 
  72. lines you see on the screen dump separate the cells.  Click the menu 
  73. (middle) button of the mouse, run the pointer through Files and then 
  74. through the sub menu Options (or use <Ctrl O> - to use <Ctrl O> you 
  75. must hold down <Ctrl>, then tap <O> and finally release <Ctrl>).  Click 
  76. on the small rectangular box just to the right of the word Grid so that 
  77. you get a blue star in the box.  When you click on OK or press <Return> 
  78. the grid will appear.
  79.  
  80. Record Numbers
  81. An easy way of generating the numbers 1 to 8 in the column A8A15 is to 
  82. use the formula (row - 7) in the column.  Start by placing the caret 
  83. in A8, tap F2 (Edit Formula) and type in the formula (row - 7) and tap 
  84. <Return>.  At this stage you may have to use <Ctrl LDP> (Layout Decimal 
  85. Places) to set zero decimal places for the numbers so that 1 (in A8) 
  86. appears as 1 and not 1.00.  Click the mouse select (left) button to 
  87. place the caret in A8, move the pointer to A15 and tap the mouse 
  88. adjust (right) button to mark the column A8A15.  Use the command 
  89. <Ctrl BRD> (Block Replicate Down) to replicate the formula down the 
  90. column (to give the numbers 1 to 8) followed by <Ctrl BSS> (Block 
  91. SnapShot) to change the formulae to fixed numbers.
  92.  
  93. The Records
  94. The rectangular block of data, B8F15, is all text and can be typed in 
  95. exactly as shown.  The rows are the database records, one record per 
  96. row and one field per column.  To move right from column to column 
  97. (field to field) you must tap the <Tab> key.  To move left you hold 
  98. down <Shift> whilst you tap <Tab>.  To move from row to row you can use 
  99. the <Return> key to move down and the up arrow key to move up.  You can 
  100. use the mouse pointer; click the select (left) mouse button with the 
  101. pointer in the cell where you want to caret.
  102.  
  103. Column Headings
  104. Row 4 is pure text; type the data in as shown.
  105.  
  106. The Key Field
  107. Type the word Name: into A5 and 'Sandy' in B5.  You have to imagine 
  108. that the database has hundreds or thousands of records (all with 
  109. different values in the key field - see Stephen Gaynor's article in the 
  110. PipeLine 3 series for the reason why the records must have a unique 
  111. key) so you can't scan your eye down the list of 8 records and pick out 
  112. Sandy immediately.  What we are going to do is make the database lookup 
  113. function (see below) find Sandy's record for you.
  114.  
  115. The Lookup Formulae
  116. Now we come to the database formulae.  Place the caret in C5, tap the 
  117. function key F2 (Edit Function) to enter a formula into C5.  Type in 
  118. the lookup formula lookup($B5,$B7$B16,C7C16) and then press <Return>.  
  119. When you press <Return> the word 'Auburn' will appear in the slot C5.  
  120. What has happened is the the lookup function has used the first 
  121. argument of the formula (the value in the cell B5) and found its value 
  122. (which is Sandy).  The second argument of the lookup function is a 
  123. range (the values in the column B7B16) and the value 'Sandy' is found 
  124. as the 5th record.  The third argument is another range (the values in 
  125. the column C7C16) and the 5th value in this range is 'Auburn' so 
  126. 'Auburn' is the value returned by the lookup function.  Summarising 
  127. this, the value of the first argument (Sandy) has been found as the 5th 
  128. value (counting from top to bottom) in the range of cells given by the 
  129. second argument and, because Sandy is the 5th item in this range, the 
  130. function lookup returns the 5th value (counting from top to bottom 
  131. again) in the range given by the third argument.
  132.  
  133. The next step is to replicate the formula in C5 across the row from C5 
  134. to F5.  The quick way is to mark the block C5 to F5, by clicking the 
  135. mouse select (left) button in C5 and the adjust (right) button in F5, 
  136. followed by the command <Ctrl BRR> (Block Replicate Right).  The $ 
  137. signs in front of the Bs in the formula ensure that the Bs remains 
  138. fixed as Bs in the newly generated formulae; the absence of $s in front 
  139. of the Cs in the third argument ensure that in column D the Cs in the 
  140. formula change to Ds.  Similarly the Cs change to Es and Fs for columns 
  141. E and F respectively.  For example, the lookup formula in E5 is 
  142. lookup($B5,$B7$B16,E7E16) which finds the value 'Fiery' as the 5th 
  143. value in the range E5E16.
  144.  
  145. The Title
  146. Complete the database by typing the title into cell C1 and you can add 
  147. an appropriate comment in C2 if you wish.
  148.  
  149. Lookup Someone Else's Record
  150. Place the caret in cell B5 (where you find Sandy), delete Sandy and 
  151. type in Julie instead.  The record in row 5 will change from being 
  152. Sandy's record to being Julie's record complete with Brown hair and 
  153. Sports Kit.  Try entering a few more of the girls' names in B5 and 
  154. watch the record in row 5 change to match.  Generally, at its simplest, 
  155. selecting a record from hundreds or thousands by entering a key is what 
  156. a database is used for.
  157.  
  158. Put Sandy's name back into B5 before you try the next exercise.
  159.  
  160. Sorting by Column
  161. The more astute of you will wonder why (in the lookup function) I have 
  162. used the range of rows from row 7 to row 16 inclusive instead of the 
  163. range from row 8 to 15.  The answer is that you can now sort the block 
  164. A8F15 without corrupting the database formulae in C5F5.  Let's sort the 
  165. block on column B so that we get the girls' names in alphabetical 
  166. order.  Using the mouse, place the caret in A8 and tap the mouse 
  167. select (left) button, then place the caret in F15 and tap the mouse 
  168. adjust (right) button; this will mark the block A8F15.  Place the 
  169. caret anywhere in column B (where the girls' names are), use the 
  170. command <Ctrl BSO> (Block SOrt) and you will find yourself with a menu 
  171. called Sort.  Although it doesn't matter in this case, if it is 
  172. necessary to do so then click the mouse select (left) button in the 
  173. Multi-row records box so that the star is removed (the blue star should 
  174. be absent by default).  Click on the OK box.  The whole block will be 
  175. sorted record by record (row by row) and Sandy's record will no longer 
  176. be the 5th but the 7th record between Sally and Sarah.  Because neither 
  177. row 7 nor row 16 have moved, the formulae in C5 to F5 remain intact.
  178.  
  179. If, in the lookup function, you had used the range from row 8 to row 15 
  180. and sorted the database so that either of the rows 8 and 15 moved, then 
  181. the lookup formula would change.  If you don't believe me then modify 
  182. the lookup formula in C5 to lookup($B5,$B8$B15,C8C15) and replicate 
  183. right (as before) from C5 to F5, sort on column A (back to the original 
  184. order) and check your formula.  Although you still have 'Auburn' in C5 
  185. the formula has changed so that now only part of the database will be 
  186. searched for Sandy.  Now try all the girls' names and you will find 
  187. that the lookup command fails with some (but not all) of them.  I have 
  188. had dozens of letters from correspondents who have sorted a database or 
  189. spreadsheet and then found that their Sum, Avg, Count, Lookup, etc fail 
  190. to give the correct answer; their problem has been that the argument of 
  191. the function such as Sum(first and last item of a long column) has 
  192. changed during sorting because they have not included two blank rows 
  193. (which are not sorted) as the first and last items in the argument of 
  194. the Sum formula.
  195.  
  196. Put the formulae back to their original form (with rows 8 and 16) 
  197. before moving on to the next exercise.
  198.  
  199. Sorting on Two Columns
  200. If you sort the database by column C then you will find two Blonds, 
  201. Jane and Sarah.  To do this sort, mark the block A8F15, place the 
  202. caret in column C and then type in the command <Ctrl BSO>.  The Auburn 
  203. haired girl, Sandy, will move up to row 8 with the two blonds in rows 
  204. 11 and 12.
  205.  
  206. It is not possible to forecast the order of the two blonds (Jane and 
  207. Sarah) from this sort operation; they are not necessarily in 
  208. alphabetical order.  However, it is possible during sorting to choose a 
  209. secondary field so that, if the first field (C, the hair colour) has 
  210. equal values then the database is sorted using the secondary field.  
  211. Using this technique you can separate the blue eyed blonds from brown 
  212. eyed blonds!  To do this, proceed as before but enter a D into the 
  213. second Sort on column dialogue box.  That way you will ensure that blue 
  214. eyed blonds precede brown eyed blonds in the sorted list.
  215.  
  216. Adding Rows
  217. Perhaps the simplest way of adding a row is to place the caret 
  218. somewhere in the middle of the data and tap F7 to insert a row.  All 
  219. the formulae in row 5 will change to match the enlarged database.  Type 
  220. in the data and, if you want to, you can sort the database again on any 
  221. column or (using a secondary key) columns.  You can also delete a 
  222. record using F8 to delete a whole row.
  223.  
  224. Over to You
  225. In DataBase2 I explain how to use a Master Row for data entry and how 
  226. to use this simple database to enter data into a 'form letter' or mail 
  227. shot.  There is nothing like experience so, before you read DataBase2, 
  228. have a go at adding more data or even changing some of the data and see 
  229. what the effect is when you sort the database.  What do you think 
  230. happens if you click in the Ascending order box?  Try inserting a few 
  231. new rows above the database, for example place the caret in A3 and tap 
  232. the function key F7 and you will see the formulae change so that the 
  233. cell references still pick up the data you want.  Add a few lines of 
  234. text.  Place the caret anywhere in column A and insert an extra column 
  235. <Ctrl EIC> to its left.  All columns in the database move to the right 
  236. (so that what was column A becomes column B etc); every reference in 
  237. all the lookup formulae are updated to match!
  238.